package com.appspot.aliga;

import java.util.Date;

import org.json.JSONException;
import org.json.JSONObject;

public class Gameday {

	private Long id;
	private int leagueID;
	private int day;
	private boolean isComplete;
	private Date fromDate;
	private Date toDate;

	public static Gameday fromJSON(JSONObject jo) {
		Gameday gd = new Gameday();
		try {
			gd.setDay(jo.getInt("day"));
			gd.setId(jo.getLong("id"));
			gd.setLeagueID(jo.getInt("leagueID"));
			gd.setComplete(jo.getBoolean("isComplete"));
			// gd.setFromDate(jo.get("fromDate"));
			// gd.setToDate(jo.get("toDate"));
		} catch (JSONException e) {
			//
		}
		return gd;
	}
	
	@Override
	public String toString() {
		return this.day + ". Spieltag";
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public int getLeagueID() {
		return leagueID;
	}

	public void setLeagueID(int leagueID) {
		this.leagueID = leagueID;
	}

	public int getDay() {
		return day;
	}

	public void setDay(int day) {
		this.day = day;
	}

	public boolean isComplete() {
		return isComplete;
	}

	public void setComplete(boolean isComplete) {
		this.isComplete = isComplete;
	}

	public Date getFromDate() {
		return fromDate;
	}

	public void setFromDate(Date fromDate) {
		this.fromDate = fromDate;
	}

	public Date getToDate() {
		return toDate;
	}

	public void setToDate(Date toDate) {
		this.toDate = toDate;
	}
}
